using System.Collections;
using UnityEngine;
using System.Collections.Generic;

/// <summary>
/// <para>事件教学节点，等待一定秒数后自动触发事件</para>
/// </summary>
public class WaitingTutorialNode : TutorialEventNode
{
	[JsonAttribute("inte", "间隔")]
	public float _interval = 1f;

    Coroutine _waitingCoroutine = null;

	protected override void Init()
	{
		_waitingCoroutine = _tutorialManager.StartCoroutine(WaitingForInterval());
	}

	protected override void Cancel()
	{
		if (_waitingCoroutine != null) {
			_tutorialManager.StopCoroutine(_waitingCoroutine);
			_waitingCoroutine = null;
		}
	}

	IEnumerator WaitingForInterval()
	{
		yield return new WaitForSeconds(_interval);

		Shoot();
	}
}
